import os
from time import sleep
from switchlang import switch

'''
pip install you-get
--format=flv     ----  1080p
'''
# http://www.autolabor.com.cn/book/ROSTutorials/
method = ["1", "2", "3", "4", "5", "6", "7"]

urls = [
    "https://www.bilibili.com/video/BV1cAzUYCEGp/?spm_id_from=333.788.videopod.sections&vd_source=60183ec2795288419ad55ebaeeaff475",
    "https://www.bilibili.com/video/BV1NoBXYFEYB?spm_id_from=333.788.videopod.sections&vd_source=60183ec2795288419ad55ebaeeaff475",
    "https://www.bilibili.com/video/BV1QaieY1E5b?spm_id_from=333.788.videopod.sections&vd_source=60183ec2795288419ad55ebaeeaff475",
]
web = "https://www.bilibili.com/video/BV1jS4y1a7Lz?p="
for i in range(len(urls)):
    command = "gnome-terminal -- you-get --format=dash-flv480 %s" % urls[i]
    os.system(command)
    print("i: ", i)
    sleep(5)
'''
with switch(method) as case:
    if case("1"):
        for i in range(len(urls)):
            command = "gnome-terminal -- you-get --format=dash-flv480 %s" % urls[i]
            os.system(command)
            print("i: ", i)
            sleep(100)
    if case("2"):
        for i in range(47, 53):
            os.system(
                "gnome-terminal -- you-get --format=dash-flv480 " + web + str(i) + str("&vd_source=60183ec2795288419ad55ebaeeaff475"))
            print("i: ", i)
            sleep(10)
    if case("3"):
        i = 46 # 11 14 31 37 39 42 43 44 45 46
        os.system(
            "gnome-terminal -- you-get --format=dash-flv480 " + web + str(i) + str("&vd_source=60183ec2795288419ad55ebaeeaff475"))
        print("i: ", i)
        sleep(3)
    if case("4"):
        http = "https://www.bilibili.com/list/287341702?tid=0&sort_field=pubtime&spm_id_from=333.999.0.0&oid=696932751&bvid=BV1zm4y1z7j1"
        command = "gnome-terminal -- you-get --format=dash-flv480 %s" % http
        os.system(command)
        sleep(10)
'''
